class Singleton:


    __instance = None
    __has_init = None


    def __new__(cls, *args, **kwargs):
        if cls.__instance is None:
            cls.__instance = super().__new__(cls)
            return cls.__instance
        return cls.__instance


    def __init__(self):
        if Singleton.__has_init:
            return
        print('执行初始化')
        Singleton.__has_init = True
s2 = Singleton()
print(s2)

s2 = Singleton()
print(s2)
